<template>
    <div style="width: 55%; margin-left: 20px">
      <el-card class="present-card" style="height: 236px;">
        <div style="height: 50px;display: flex;">
            <h3 style="line-height: 20px; ">判别结果</h3>
        </div>
        <div v-show="type=='1'" style="display: flex;">
            <div style="background-color: red; border-radius:16ch; 
            height: 140px; width: 140px; text-align: center;
            margin-left: 100px; margin-right: 100px; display: flex;">
            <h2 style="margin-top: 54px; margin-left: 45px;">危险</h2>
            </div>
            <h2 style="margin-top: 54px;" >该文件存在于黑名单中，被判定为危险！</h2>
        </div>

        <div v-show="type=='-1'" style="display: flex;">
            <div style="background-color: greenyellow; border-radius:16ch; 
            height: 140px; width: 140px; text-align: center;
            margin-left: 100px; margin-right: 100px; display: flex;">
            <h2 style="margin-top: 54px; margin-left: 45px;">安全</h2>
            </div>
            <h2 style="margin-top: 54px;" >该文件存在于白名单中，被判定为安全！</h2>
        </div>
        </el-card>
        <br>
    </div>
  </template>
    
    <script>
    export default {
      data() {
        return {
          model_1: [],
          model_2: [], 
          model_3: [], 
          model_4: [],   
          baseURL: "http://localhost:8000/",
          LS:{color:'#000'},
          LD:{size:'xxx-larger'},
          ID:[],
          type:'',
          options:[
            {
                value:'选项1',
                label:'ResNet'
            },
            {
                value:'选项2',
                label:'随机森林'
            },
            {
                value:'选项3',
                label:'k近邻'
            },
            {
                value:'选项4',
                label:'SVM'
            },
          ],
          value: '选项1'
        }
      },
    
      mounted() {
        this.savedata();
        // this.getMessages();
      },
    
      methods: {
        savedata() {
          var item = localStorage.getItem("data");
          var parse = JSON.parse(item);
          this.type = parse["Apk_info_id"];
        },
        getMessages:function(){
          //记录this的地址
          let that = this
          //使用Axios实现Ajax请求
          that.axios.get(that.baseURL+"apk/model_predict/"+that.ID+"/")
          .then(function(res){
            //请求成功后执行的函数
            that.model_4 = res.data[0];
            that.model_3 = res.data[1];
            that.model_2 = res.data[2];
            that.model_1 = res.data[3];
  
          })
          .catch(function(err){
            //请求失败后执行的函数
            console.log(err)
          })
        },
      }
    
    }
    </script>
    
    <style>
    
    </style>
  